package com.jvm.java2;

interface Huntable {
    void hunt();
}

/**
 * @ClassName HuangXiangXiang
 * @Date 2020/12/4 0:36
 * @Version V1.0
 **/

class Animal {
    public void eat() {
        System.out.println("动物进食");
    }
}

class Dog extends Animal implements Huntable {

    public void eat() {
        System.out.println("狗吃骨头");
    }

    public void hunt() {
        System.out.println("扑食耗子。。。多管闲事");
    }
}


class Cat extends Animal implements Huntable {

    public Cat() {
        super(); //表现为早期
    }

    public Cat(String name) {
        this(); //表现为早期
    }

    public void eat() {
        System.out.println("猫吃鱼");
    }

    public void hunt() {
        System.out.println("扑食耗子。。。天经地义");
    }
}


public class AnimalTest {

    public void showAnimal(Animal animal) {
        animal.eat();  //变现为晚期绑定
    }


    public void showHunt(Huntable huntable) {
        huntable.hunt();  //接口更是了、接口本身就不能实例化
    }
}
